home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2001 December / pcwk12201b.iso / Wersje pelne i specjalne / Winamp 2.77 i 3.0beta / wasabi-sdk_beta1.exe / studio / common / editwnd.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  3KB  |  91 lines

  1. /*
  2.  
  3.   Nullsoft WASABI Source File License
  4.  
  5.   Copyright 1999-2001 Nullsoft, Inc.
  6.  
  7.     This software is provided 'as-is', without any express or implied
  8.     warranty.  In no event will the authors be held liable for any damages
  9.     arising from the use of this software.
  10.  
  11.     Permission is granted to anyone to use this software for any purpose,
  12.     including commercial applications, and to alter it and redistribute it
  13.     freely, subject to the following restrictions:
  14.  
  15.     1. The origin of this software must not be misrepresented; you must not
  16.        claim that you wrote the original software. If you use this software
  17.        in a product, an acknowledgment in the product documentation would be
  18.        appreciated but is not required.
  19.     2. Altered source versions must be plainly marked as such, and must not be
  20.        misrepresented as being the original software.
  21.     3. This notice may not be removed or altered from any source distribution.
  22.  
  23.  
  24.   Brennan Underwood
  25.   brennan@nullsoft.com
  26.  
  27. */
  28.  
  29. //NONPORTABLE
  30. #ifndef _EDITWND_H
  31. #define _EDITWND_H
  32.  
  33. #include "basewnd.h"
  34. #include "./usermsg.h"
  35. #include "common.h"
  36.  
  37. #define EDITWND_PARENT BaseWnd
  38. class COMEXP EditWnd : public BaseWnd {
  39. public:
  40.   EditWnd(char *buffer=NULL, int buflen=0);
  41.   virtual ~EditWnd();
  42.  
  43.   virtual int onInit();
  44.   virtual int onPaint(Canvas *canvas);
  45.   virtual int onResize();
  46.   virtual LRESULT wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  47.  
  48.   void setBuffer(char *buffer, int len);
  49.   void getBuffer(char *outbuf, int len);
  50.   void setModal(int modal);//if modal, deletes self on enter
  51.   void setBorder(int border);
  52.   int getTextLength();
  53.   void setAutoEnter(int a);
  54.   
  55.   // the wndproc for the edit box
  56.   LRESULT editWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  57.   HWND getEditWnd();
  58.   virtual int handleRatio() { return 0; }
  59.   virtual int getAutoSelect() { return autoselect; }
  60.   void setAutoSelect(int a) { autoselect = a; };
  61.  
  62. protected:
  63.   virtual void timerCallback(int id);
  64.  
  65.   // call down on these if you override them
  66.   virtual void onEditUpdate();
  67.   virtual void onIdleEditUpdate();
  68.   virtual int onEnter();    // user hit enter.. return 1 to close window
  69.   virtual int onAbort();    // user hit escape.. return 1 to close window
  70.   virtual int onLoseFocus();    // different from onKillFocus() from BaseWnd!
  71.  
  72. private:
  73.   HWND editWnd;
  74.   WNDPROC prevWndProc;
  75.   char *outbuf;
  76.   int maxlen;
  77.   int retcode;
  78.   int idletimelen;
  79.   int modal;
  80.   int bordered;
  81.   int autoenter;
  82.   int beforefirstresize;
  83.   int autoselect;
  84. };
  85.  
  86. #define EDITWND_RETURN_NOTHING    0    // user didn't do nothing
  87. #define EDITWND_RETURN_OK    1    // user hit return
  88. #define EDITWND_RETURN_CANCEL    2    // user hit escape or something
  89.  
  90. #endif
  91.